Skip to content

fix: normalize extract slugs and dir parsing#184

Open
24601 wants to merge 1 commit intogarrytan:masterfrom
24601:fix/extract-slugified-links
Open

fix: normalize extract slugs and dir parsing#184
24601 wants to merge 1 commit intogarrytan:masterfrom
24601:fix/extract-slugified-links

Conversation

@24601
Copy link
Copy Markdown

@24601 24601 commented Apr 17, 2026

Summary

  • slugify extracted markdown link paths the same way import/sync slugify page paths
  • let sync-time extraction find files by slugified path instead of assuming slug + '.md' exists on disk
  • accept a positional brain dir for gbrain extract in addition to --dir, so gbrain extract links /path/to/brain works as users expect
  • add regression tests for uppercase filenames / slugified paths and positional-dir CLI behavior

Why this matters

There were two sharp edges in extraction:

  1. extraction used raw repo-relative paths like Folder/INDEX while import stored slugified paths like folder/index, so links/timeline for uppercased or otherwise-normalized filenames silently failed to materialize;
  2. gbrain extract links /path/to/brain silently ignored the positional path and scanned . unless the caller knew to pass --dir.

Together those make the graph look much flatter than the corpus actually is.

Test plan

  • bun test test/extract.test.ts
  • bun test test/extract.test.ts test/slug-validation.test.ts test/sync.test.ts
  • bun test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant